package org.huangrui.javase.collectionMap.map;

import java.util.Objects;

/**
 * @Author hr
 * @Create 2025-11-07 17:01
 **/
public class MyKey {
    private int num;

    public MyKey(int num) {
        this.num = num;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MyKey myKey = (MyKey) o;
        return num == myKey.num;
    }

    @Override
    public int hashCode() {
        if(num<=20){
            return 1;//人为制造冲突
        }
        return Objects.hashCode(num);
    }
}
